package com.g8.pethospitallearnbackend.mapper;

import com.g8.pethospitallearnbackend.entity.PaperQuestion;
import com.g8.pethospitallearnbackend.entity.PaperQuestionExample;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;

import java.util.List;

public interface PaperQuestionMapper {
    @SelectProvider(type=PaperQuestionSqlProvider.class, method="countByExample")
    long countByExample(PaperQuestionExample example);

    @DeleteProvider(type=PaperQuestionSqlProvider.class, method="deleteByExample")
    int deleteByExample(PaperQuestionExample example);

    @Insert({
        "insert into paper_question (paper_id, ques_id, ",
        "score)",
        "values (#{paperId,jdbcType=VARCHAR}, #{quesId,jdbcType=VARCHAR}, ",
        "#{score,jdbcType=INTEGER})"
    })
    int insert(PaperQuestion record);

    @InsertProvider(type=PaperQuestionSqlProvider.class, method="insertSelective")
    int insertSelective(PaperQuestion record);

    @SelectProvider(type=PaperQuestionSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="paper_id", property="paperId", jdbcType=JdbcType.VARCHAR),
        @Result(column="ques_id", property="quesId", jdbcType=JdbcType.VARCHAR),
        @Result(column="score", property="score", jdbcType=JdbcType.INTEGER)
    })
    List<PaperQuestion> selectByExample(PaperQuestionExample example);

    @UpdateProvider(type=PaperQuestionSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") PaperQuestion record, @Param("example") PaperQuestionExample example);

    @UpdateProvider(type=PaperQuestionSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") PaperQuestion record, @Param("example") PaperQuestionExample example);
}